﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Kandy/K_Master.master" AutoEventWireup="true" CodeFile="K_Issue_Approve.aspx.cs" Inherits="Kandy_K_Issue_Approve" %>

<%@ Register Assembly="DevExpress.Web.ASPxGridView.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>

<%@ Register Assembly="DevExpress.Web.ASPxEditors.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
    <style type="text/css">
    .style2
    {
        width: 100%;
    }
    .style3
    {
    }
    .style4
    {
    }
    .style5
    {
        width: 230px;
    }
    .style6
    {
        width: 104px;
    }
        .style7
        {
            font-size: medium;
        }
    </style>
</asp:Content>


<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <table class="style2">
    <tr>
        <td class="style3" colspan="2">
            &nbsp;</td>
        <td class="style4" colspan="4">
            &nbsp;</td>
        <td>
            &nbsp;</td>
        <td>
            &nbsp;</td>
    </tr>
    <tr>
        <td class="style3" colspan="2">
            &nbsp;</td>
        <td>
            <strong>Issue Approve
        </strong>
        </td>
        <td colspan="2">
            
                <strong>
               
                
                <dx:aspxcombobox ID="DropDownList1" runat="server" ClientIDMode="AutoID"  
                        DropDownStyle="DropDown" IncrementalFilteringMode="StartsWith"
                 DataSourceID="SqlDataSource2" 
                           
                    TextField="Issue_ID" TextFormatString="{0}"  ValueType="System.String"
                            ValueField="Issue_ID" 
                        CssFilePath="~/App_Themes/BlackGlass/{0}/styles.css" CssPostfix="BlackGlass" 
                       
                        SpriteCssFilePath="~/App_Themes/BlackGlass/{0}/sprite.css" 
                Width="200px" AutoPostBack="True" 
                        >
                        <LoadingPanelImage Url="~/App_Themes/BlackGlass/Editors/Loading.gif">
                        </LoadingPanelImage>
                        <ButtonStyle Width="11px">
                        </ButtonStyle>
                        <ValidationSettings ErrorText="Error has occurred">
                            <ErrorFrameStyle ImageSpacing="4px">
                                <ErrorTextPaddings PaddingLeft="4px" />
                            </ErrorFrameStyle>
                        </ValidationSettings>
                    </dx:aspxcombobox>
                </strong>
        </td>
        <td class="style4">
            &nbsp;</td>
        <td>
            &nbsp;</td>
        <td>
            &nbsp;</td>
    </tr>
    <tr>
        <td class="style3" colspan="2">
            &nbsp;</td>
        <td class="style4" colspan="4">
            
            &nbsp;</td>
        <td>
            &nbsp;</td>
        <td>
            &nbsp;</td>
    </tr>
    <tr>
        <td class="style3" colspan="8">
            <dx:ASPxGridView ID="ASPxGridView2" ClientInstanceName="ASPxGridView2" 
        runat="server" AutoGenerateColumns="False" 
        ClientIDMode="AutoID" CssFilePath="~/App_Themes/BlackGlass/{0}/styles.css" 
        CssPostfix="BlackGlass" DataSourceID="SqlDataSource1"  KeyFieldName="Issue_ID;Pro_ID;GRN_Key"
        Width="100%" 
        
       >
        <Columns>
            <dx:GridViewCommandColumn VisibleIndex="0" ShowSelectCheckbox="True">
            <HeaderTemplate>
                    <dx:ASPxCheckBox ID="SelectAllCheckBox" runat="server" ToolTip="Select/Unselect all rows on the page"
                        ClientSideEvents-CheckedChanged="function(s, e) {  ASPxGridView2.SelectAllRowsOnPage(s.GetChecked()); }" />
                </HeaderTemplate>
                <ClearFilterButton Visible="True">
                </ClearFilterButton>
                <HeaderStyle HorizontalAlign="Center" />
                
            </dx:GridViewCommandColumn>
                  
            <dx:GridViewDataTextColumn FieldName="Pro_ID" ShowInCustomizationForm="True" ReadOnly="false"
                VisibleIndex="1" Caption="Item ID">
                <EditFormSettings Visible="False" />
<EditFormSettings Visible="False"></EditFormSettings>

                <EditCellStyle ForeColor="Blue">
                </EditCellStyle>
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="Code" ShowInCustomizationForm="True" ReadOnly="false" 
                VisibleIndex="2">
<EditFormSettings Visible="False"></EditFormSettings>

                <EditCellStyle ForeColor="Blue">
                </EditCellStyle>
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn Caption="Stock Code" FieldName="Sto_ID" 
                ShowInCustomizationForm="True" VisibleIndex="3">
                <EditFormSettings Visible="False" />
                <EditCellStyle ForeColor="Blue">
                </EditCellStyle>
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataComboBoxColumn FieldName="Pro_Name" VisibleIndex="4" ReadOnly="True" 
                Caption="Item">
                <PropertiesComboBox TextField="Pro_Name" ValueField="Pro_Name" EnableSynchronization="False"
                    IncrementalFilteringMode="StartsWith" DataSourceID="SqlDataSource3">
                
                </PropertiesComboBox>
                <EditCellStyle ForeColor="Blue">
                </EditCellStyle>
            </dx:GridViewDataComboBoxColumn>
            <dx:GridViewDataTextColumn FieldName="Brand_Name" VisibleIndex="5">
            </dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="Ret_Price" ReadOnly="True" 
                ShowInCustomizationForm="True" Caption="Marked Price" VisibleIndex="6">
</dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="Pur_Price" VisibleIndex="7" ReadOnly="true" 
                Caption="Cost" ShowInCustomizationForm="True" Visible="False" >
                <PropertiesTextEdit DisplayFormatString="Rs.{0}">
                </PropertiesTextEdit>
                <EditCellStyle ForeColor="Blue">
                </EditCellStyle>
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn Caption="Point Value" FieldName="Point_Value" 
                ReadOnly="True" VisibleIndex="8">
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn Caption="Business Value" FieldName="Business_Value" 
                ReadOnly="True" VisibleIndex="9">
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="Qty" VisibleIndex="10" Caption="Quantity"   
                ShowInCustomizationForm="True">
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="Description" VisibleIndex="11" 
                Caption="Description" ShowInCustomizationForm="True">

            </dx:GridViewDataTextColumn>
            <dx:GridViewDataSpinEditColumn Caption="Line Total" FieldName="Total" 
                UnboundType="Decimal" VisibleIndex="12" ReadOnly="True" Visible="False">
                <PropertiesSpinEdit DisplayFormatString="Rs.{0}" NumberFormat="Custom">
                </PropertiesSpinEdit>
                <EditFormSettings Visible="False" />

<EditFormSettings Visible="False"></EditFormSettings>
            </dx:GridViewDataSpinEditColumn>
            <dx:GridViewDataTextColumn FieldName="GRN_Key" Visible="False" 
                VisibleIndex="13">
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="Issue_ID" Visible="False" 
                VisibleIndex="14">
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="Branch" Visible="False" VisibleIndex="15">
            </dx:GridViewDataTextColumn>
        </Columns>
        <SettingsBehavior ConfirmDelete="True" />

<SettingsBehavior ConfirmDelete="True"></SettingsBehavior>

        <SettingsPager PageSize="25">
        </SettingsPager>
        <Settings ShowFilterRow="True" />

<Settings ShowFilterRow="True" showfooter="True"></Settings>

        <images spritecssfilepath="~/App_Themes/BlackGlass/{0}/sprite.css">
            <loadingpanelonstatusbar url="~/App_Themes/BlackGlass/GridView/gvLoadingOnStatusBar.gif">
            </loadingpanelonstatusbar>
            <loadingpanel url="~/App_Themes/BlackGlass/GridView/Loading.gif">
            </loadingpanel>
        </images>
        <imagesfiltercontrol>
            <loadingpanel url="~/App_Themes/BlackGlass/Editors/Loading.gif">
            </loadingpanel>
        </imagesfiltercontrol>
        <styles cssfilepath="~/App_Themes/BlackGlass/{0}/styles.css" 
            csspostfix="BlackGlass">
            <header imagespacing="5px" sortingimagespacing="5px">
            </header>
        </styles>
        <styleseditors>
            <calendarheader spacing="1px">
            </calendarheader>
            <progressbar height="25px">
            </progressbar>
        </styleseditors>
    </dx:aspxgridview>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:BestlifeDBConnectionString %>" 
                                
                
                SelectCommand="SELECT Tbl_Iss_Request.GRN_Key, Tbl_Iss_Request.Issue_ID, Tbl_Iss_Request.Pro_Name, Tbl_Iss_Request.Pur_Price, Tbl_Iss_Request.Description, Tbl_Iss_Request.Sto_ID, Tbl_Iss_Request.Qty, Tbl_Iss_Request.manger_status, Tbl_Iss_Request.status, Tbl_Iss_Request.Pro_ID, Tbl_Product.Ret_Price, Tbl_Product.Point_Value, Tbl_Product.Business_Value, Tbl_Iss_Request.Code, Tbl_Product.Brand_Name, Tbl_Iss_Request.Branch FROM Tbl_Iss_Request INNER JOIN Tbl_Product ON Tbl_Iss_Request.Code = Tbl_Product.Code AND Tbl_Iss_Request.Pro_ID = Tbl_Product.Pro_ID WHERE (Tbl_Iss_Request.manger_status IS NULL) AND (Tbl_Iss_Request.Issue_ID = @Issue_ID) AND (Tbl_Iss_Request.Branch = @Branch)" 
                
                UpdateCommand="UPDATE Tbl_Iss_Request SET Description =@Description , Qty =@Qty  where GRN_Key = @GRN_Key" 
                DeleteCommand="DELETE FROM Tbl_Iss_Request WHERE (GRN_Key = @GRN_Key)">

                            

                <DeleteParameters>
                    <asp:Parameter Name="GRN_Key" />
                </DeleteParameters>

                            

                <SelectParameters>
            <asp:ControlParameter ControlID="DropDownList1" Name="Issue_ID" Type="Int32" />
                    <asp:Parameter Name="Branch" DefaultValue="Kandy" />
        </SelectParameters>
                <UpdateParameters>
                    <asp:Parameter Name="Description" />
                    <asp:Parameter Name="Qty" />
                    <asp:Parameter Name="GRN_Key" />
                </UpdateParameters>
            </asp:SqlDataSource>
    
            <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                ConnectionString="<%$ ConnectionStrings:BestlifeDBConnectionString %>" 
                
                
                SelectCommand="SELECT DISTINCT Issue_ID FROM Tbl_Iss_Request WHERE (manger_status IS NULL) AND (Branch = @Branch)">
                <SelectParameters>
                    <asp:Parameter DefaultValue="Kandy" Name="Branch" />
                </SelectParameters>
            </asp:SqlDataSource>
    
    <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
        ConnectionString="<%$ ConnectionStrings:BestlifeDBConnectionString %>" 
        SelectCommand="SELECT Pro_Name FROM Tbl_Product" >

          </asp:SqlDataSource>

        </td>
    </tr>
    <tr>
        <td class="style6">
            &nbsp;</td>
        <td class="style5">
            <strong>
                <dx:ASPxLabel ID="ASPxLabel5" runat="server" ForeColor="#009933"></dx:ASPxLabel>            
            </strong></td>
        <td class="style4" colspan="4">
            &nbsp;</td>
        <td>
            &nbsp;</td>
        <td>
            &nbsp;</td>
    </tr>
    <tr>
        <td class="style3" colspan="2">
            &nbsp;</td>
        <td colspan="2" class="style7">
            <strong>Aprrove</strong></td>
        <td class="style4" colspan="2">
            <asp:DropDownList ID="DropDownList2" runat="server" style="margin-left: 0px">
                <asp:ListItem>YES</asp:ListItem>
            </asp:DropDownList>
        </td>
        <td>
            &nbsp;</td>
        <td>
            &nbsp;</td>
    </tr>
    <tr>
        <td class="style3" colspan="2">
            &nbsp;</td>
        <td class="style4" colspan="4">
            <dx:aspxbutton ID="ASPxButton2" runat="server" ClientIDMode="AutoID" 
                CssFilePath="~/App_Themes/BlackGlass/{0}/styles.css" CssPostfix="BlackGlass" 
                SpriteCssFilePath="~/App_Themes/BlackGlass/{0}/sprite.css" Text="Approve" 
                onclick="ASPxButton1_Click">
            </dx:aspxbutton>
        </td>
        <td>
            &nbsp;</td>
        <td>
            &nbsp;</td>
    </tr>
    <tr>
        <td class="style3" colspan="2">
            <dx:aspxlabel ID="ASPxLabel2" runat="server">
            </dx:aspxlabel>
        </td>
        <td class="style4" colspan="4">
            &nbsp;</td>
        <td>
            &nbsp;</td>
        <td>
            &nbsp;</td>
    </tr>
    <tr>
        <td class="style3" colspan="2">
            &nbsp;</td>
        <td class="style4" colspan="4">
            &nbsp;</td>
        <td>
            &nbsp;</td>
        <td>
            &nbsp;</td>
    </tr>
    </table>
</asp:Content>

